﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AsteroidScript : MonoBehaviour
{
    //声明物体的旋转速度
    public float angularSpeed = 3f;

    public float moveSpeed = -3f;

    // Start is called before the first frame update
    void Start()    
    {
        //声明Rigidbody刚体属性
        Rigidbody rigidbody1;
        //绑定组件
        rigidbody1 = this.GetComponent<Rigidbody>();
        //设置旋转速度
        rigidbody1.angularVelocity = Random.insideUnitSphere * angularSpeed;
        //设置移动速度
        rigidbody1.velocity = transform.forward * moveSpeed;
    }

   
}
